﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MetroIoc;
using Microsoft.Practices.ServiceLocation;

namespace Prism.Extensions.MetroIOC
{
    public class MetroIocServiceLocatorAdapter : ServiceLocatorImplBase
    {
        private readonly IContainer _container;

        public MetroIocServiceLocatorAdapter(IContainer container)
        {
            _container = container;
        }

        protected override IEnumerable<object> DoGetAllInstances(Type serviceType)
        {
            return _container.ResolveAll(serviceType);
           
        }

        protected override object DoGetInstance(Type serviceType, string key)
        {
            return _container.Resolve(serviceType, key);
        }
    }
}
